
class BreadSlice extends RocketMk2;

#exec MESH IMPORT MESH=ToastProjectile ANIVFILE=MODELS\ToastProjectile_a.3d DATAFILE=MODELS\ToastProjectile_d.3d X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=ToastProjectile X=0 Y=0 Z=0

#exec MESH SEQUENCE  MESH=ToastProjectile SEQ=All  STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE  MESH=ToastProjectile SEQ=Wing STARTFRAME=0 NUMFRAMES=1
#exec MESH LODPARAMS MESH=ToastProjectile STRENGTH=0
#exec MESHMAP NEW MESHMAP=ToastProjectile MESH=ToastProjectile
#exec MESHMAP SCALE MESHMAP=ToastProjectile X=1 Y=1 Z=2

#exec TEXTURE IMPORT NAME=ToastProjUVmap FILE=Textures/ToastProjUVmap.pcx GROUP=Skins LODSET=2
#exec TEXTURE IMPORT NAME=ToastProjUVmap FILE=Textures/ToastProjUVmap.pcx GROUP=Skins PALETTE=ToastProjUVmap
#exec MESHMAP SETTEXTURE MESHMAP=ToastProjectile NUM=1 TEXTURE=ToastProjUVmap

var float SmokeRate;
var bool bRing,bHitWater,bWaterStart;
var int NumExtraRockets;
var redeemertrail trail;

simulated function Timer()
{
    local ut_SpriteSmokePuff b;

    if ( Trail == None )
        Trail = Spawn(class'RedeemerTrail',self);
    
	 if ( Region.Zone.bWaterZone || (Level.NetMode == NM_DedicatedServer) )
    {
        SetTimer(SmokeRate, false);
        Return;
    }

    if ( Level.bHighDetailMode )
    {
        if ( Level.bDropDetail )
            Spawn(class'LightSmokeTrail');
        else
            Spawn(class'UTSmokeTrail');
        SmokeRate = 152/Speed; 
    }
    else 
    {
        SmokeRate = 0.35;
        b = Spawn(class'ut_SpriteSmokePuff');
        b.RemoteRole = ROLE_None;
    }
    SetTimer(SmokeRate, false);

}

simulated function Destroyed()
{
   if ( Trail != None )
      Trail.Destroy();
   Super.Destroyed();
}

simulated function PostBeginPlay()
{
   if ( Level.bHighDetailMode )
   {
      SmokeRate = (200 + (0.5 + 2 * FRand()) * NumExtraRockets * 24)/Speed;
      if ( Level.bDropDetail )
      {
         SoundRadius = 6;
         LightRadius = 3;
      }
   }
   else
   {
      SmokeRate = 0.15 + FRand()*(0.02+NumExtraRockets);
      LightRadius = 3;
   }
   SetTimer(SmokeRate, true);
}


auto state Flying
{

	simulated function ZoneChange( Zoneinfo NewZone )
   {
      local waterring w;
        
      if (!NewZone.bWaterZone || bHitWater) Return;

      bHitWater = True;
      if ( Level.NetMode != NM_DedicatedServer )
      {
         w = Spawn(class'WaterRing',,,,rot(16384,0,0));
         w.DrawScale = 0.2;
         w.RemoteRole = ROLE_None;
         PlayAnim( 'Still', 3.0 );
      }
      Velocity=0.6*Velocity;
   }

   simulated function ProcessTouch (Actor Other, Vector HitLocation)
   {
      if ( (Other != instigator) && !Other.IsA('Projectile') )
         Explode(HitLocation,Normal(HitLocation-Other.Location));
   }

   function BlowUp(vector HitLocation)
   {
      HurtRadius(Damage,320.0, MyDamageType, MomentumTransfer, HitLocation );  //increased from 220 radius
      MakeNoise(1.0);
   }

   simulated function Explode(vector HitLocation, vector HitNormal)
   {
      local UT_SpriteBallExplosion s;
      local int i;

      spawn(class'ToastChips',,,);
      PlaySound(MiscSound, SLOT_Misc);
      s = spawn(class'ToastExplosion',,,HitLocation + HitNormal*16);
      s.RemoteRole = ROLE_None;

      BlowUp(HitLocation);
      for ( i=0; i<3; i++ )
   	{
			Spawn(class'ToastChunk1',,,Location);
		}
		Spawn(class'UT_SpriteSmokePuff',,,HitLocation);

      Destroy();
   }

    function BeginState()
    {
        local vector Dir;

      Dir = vector(Rotation);
      Velocity = speed * Dir;
      Acceleration = Dir * 50;
      PlayAnim( 'Wing', 0.2 );
      if (Region.Zone.bWaterZone)
      {
         bHitWater = True;
         Velocity=0.6*Velocity;
      }
   }
}

defaultproperties
{
   ExplosionDecal=class'ToastMark'
   MyDamageType=RocketDeath
   speed=1000.000000
   MaxSpeed=1000.000000
   Damage=80.000000
   MomentumTransfer=50000
   SpawnSound=Sound'UnrealShare.Eightball.Ignite'
   MiscSound=Sound'UnrealShare.General.Explg02'
   RemoteRole=ROLE_SimulatedProxy
   LifeSpan=12.000000
   AnimSequence=WingIn
   Mesh=ToastProjectile
   DrawScale=0.020000
   AmbientGlow=64
   bUnlit=True
   bMeshCurvy=False
   SoundRadius=14
   SoundVolume=255
   SoundPitch=100
   AmbientSound=Sound'Botpack.RocketLauncher.Rocketfly1'
   LightType=LT_Steady
   LightEffect=LE_NonIncidence
   LightBrightness=255
   LightHue=28
   LightSaturation=0
   LightRadius=6
   bBounce=True
   bFixedRotationDir=True
   RotationRate=(Roll=10000)
   DesiredRotation=(Pitch=12000,Yaw=5666,Roll=2334)
}
